{% extends "AcmeLikipeBlogBundle::Common/layout.html.twig" %}


{% block title %}
 Home Page
{% endblock %}

{% block content %}

{% if app.session.hasFlash('warning') %}
<h1>{{ app.session.flash('warning') }}</h1>
{% else %}

{% if app.session.hasFlash('notice') %}
<span style="color: red">{{ app.session.flash('notice') }}</span>
{% endif %}
<h1>List Blogs</h1>

{% for blog in blogs %}
<div class="block">
	<div class="block_blog blog_title">
		<a onclick="show_post('{{ blog.id }}')" title="Click to view all posts">{{ blog.title }}</a>
	</div>
	<div class="block_blog" id="list_post_{{ blog.id }}" style="display: none;">
		{% for post in blog.posts %}
		<div class="block_post">
			<div>Author: {{ post.author }}</div>
			<div>Content: {{ post.content }}</div>
			<div>Created: {{ post.created|date('d/m/y - H:i:s') }}</div>
		</div>
		{% endfor %}
	</div>
	<div style="width: 100%; height: 10px;"></div>
</div>
{% endfor %}

{% endif %}

{% endblock %}

{% block javascript %}
 <script type="text/javascript">
<!--
function show_post(id){
	$('#list_post_' + id).slideToggle();
}
//-->
</script>
{% endblock %}


